package comq.hnevc.androidui3;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;

public class MainActivity extends AppCompatActivity {

class MyOnClickListener implements View.OnClickListener{

    @Override
    public void onClick(View v) {
        Toast.makeText(MainActivity.this, "登录失败", Toast.LENGTH_SHORT).show();

    }
}


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.jujie_layout);
        Button btnLogin=findViewById(R.id.btn_login);//获取

                MyOnClickListener listener=new MyOnClickListener();//创建监听器对象

        btnLogin.setOnClickListener(listener);//为btnLogin设置监听对象
    }

    public void click(View view) {
        Toast.makeText(this, "你好啊", Toast.LENGTH_SHORT).show();
    }
    
}

